import java.util.Arrays;
import java.util.Scanner;
class PersonOverride{
	private String name;
	private boolean gender;
	private int age;

	public  PersonOverride(){
		this("default",1,true);
	}
	
	public PersonOverride(String name,int age,boolean gender){
	this.name = name;
	this.age = age;
	this.gender = gender;
     }	
	
	
	
	public String toString()   {
	      return name+"-"+age+"-"+gender;
	  }
	public boolean equals(PersonOverride Object){
		PersonOverride other = (PersonOverride) Object;
		if (age != other.age)
			return false;
		if (gender != other.gender)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} 
		else if (!name.equals(other.name))return false;
		return true;
		
	}	
}

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n1=input.nextInt();
		
		PersonOverride[]person1=new PersonOverride[n1];
		
		
		int n2=input.nextInt();
		PersonOverride[]person2=new PersonOverride[n2];
		int i=0;
		while(i<n2){
			PersonOverride person=new PersonOverride(input.next(),input.nextInt(),input.nextBoolean());
			int count=0;
			while(count<i){
				if(person2[count].equals(person)){
					n2--;
					break;
				}
				count++;
			}
			if(count==i){
				person2[count]=person;
				i++;
			}
		}	
		for(int m=0;m<n1;m++){
			person1[m]=new PersonOverride();
			System.out.println(person1[m]);
		}
		for(int k=0;k<n2;k++){
			System.out.println(person2[k].toString());
		}
		
		System.out.println(n2);
		System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
			}
			
	}

